package com.ankicoo.auth.Interceptor;

import org.springframework.lang.NonNull;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * description: Http请求拦截器
 * @author QCYANG
 * created_time: 2020/5/19 10:04
 */
@Component
public class HttpRequestInterceptor implements HandlerInterceptor {
  @Override
  public boolean preHandle(@NonNull HttpServletRequest request, HttpServletResponse response,@NonNull Object handler){
    response.setHeader("Access-Control-Allow-Origin", "*");
    response.setHeader("Access-Control-Allow-Credentials", "true");
    response.setHeader("Access-Control-Allow-Methods", "*");
    response.setHeader("Access-Control-Allow-Headers", "Content-Type,Access-Token");
    response.setHeader("Access-Control-Expose-Headers", "*");
    return true;
  }

}
